package com.tgy.service;

import com.tgy.entity.Dept;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/***
 * @ClassName: DeptClientService
 * @Description:
 * @Auther: 送一一块二向箔
 * @Date: 16:05 2022/1/14
 * @version : V1.0
 */

@Component
@FeignClient(value ="ProviderDept01",fallbackFactory = DeptClientServiceFallbackFactory.class)
public interface DeptClientService {

/*
* 这里需要和Provider的接口一致
* 有点类似于Dubbo接口调用
* */

    @RequestMapping("/test")
    public String test();

    @RequestMapping("/all")
    public List<Dept> all();

    @PostMapping("/list")
    public List<Dept> list(@RequestBody Dept dept);

    @PostMapping("/add")
    public Boolean add(@RequestBody Dept dept);

    @PostMapping("/upd")
    public Boolean upd(@RequestBody Dept dept);

    @GetMapping("/delR/{id}")
    public Integer delR(@PathVariable(name = "id", required = true) Long id );

    @GetMapping("/del")
    public Integer del(@RequestParam(name ="id") Long id );

    @GetMapping("/id/{id}")
    public Dept id(@PathVariable(name = "id", required = true) Long id );
}
